package com.senney.practice.spring.jdbc;

import com.senney.practice.spring.bean.Employee;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.SQLOutput;

public class TestJdbcTemplate {
    public static void main(String[] args) {
        ApplicationContext ctx = new ClassPathXmlApplicationContext("classpath:spring.xml");
        JdbcTempCRUD jdbcTempCRUD = ctx.getBean(JdbcTempCRUD.class);
        System.out.println(jdbcTempCRUD.findEmployeeById(1L));
        System.out.println(jdbcTempCRUD.insertEmployee(new Employee(null,"tom","男","tom@163.com")));
        System.out.println(jdbcTempCRUD.findEmployee("e"));
        System.out.println(jdbcTempCRUD.updateEmployee(new Employee(4,"Senney","男","tom123456@163.com")));
        System.out.println(jdbcTempCRUD.deleteEmployee(5L));
    }
}
